package com.cbd.pojo;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotEmpty;
import org.springframework.validation.annotation.Validated;
import com.fasterxml.jackson.annotation.JsonUnwrapped;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

/**
 * 合同 企业从平台租用车位的合同
 * 
 */
@Entity
@Table(name="companypact")

@Validated
public class Companypact implements Serializable{
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name="pactID")
	private int pactID;
	/**
	 * 合同编号
	 * 
	 */
	@Column(name="pactNO")
	@NotEmpty(message="不能为空")
	@Length(max=15,min=6,message="长度必须为6-15位之间")
	private String pactNO;
	/**
	 * 合同生效日期
	 * 
	 */
	@Column(name="pactStartTime")
	private Date pactStartTime;
	/**
	 * 合同到期日期
	 * 
	 */
	@Column(name="pactEndTime")
	private Date pactEndTime;
	/**
	 * 合同状态 是否解约 0：没有解约 1：解约成功
	 * 
	 */
	@Column(name="type")
	private boolean type;
	@ManyToOne(cascade=CascadeType.ALL)
	@JoinColumn(name="companyID")
	private Company comp;
	@OneToMany(cascade=CascadeType.ALL,mappedBy="companyPact") 
	private List<Companycarport> companycarport;

	public List<Companycarport> getCompanycarport() {
		return companycarport;
	}

	public void setCompanycarport(List<Companycarport> companycarport) {
		this.companycarport = companycarport;
	}

	public int getPactID() {
		return pactID;
	}

	public void setPactID(int pactID) {
		this.pactID = pactID;
	}

	public String getPactNO() {
		return pactNO;
	}

	public void setPactNO(String pactNO) {
		this.pactNO = pactNO;
	}

	public Date getPactStartTime() {
		return pactStartTime;
	}

	public void setPactStartTime(Date pactStartTime) {
		this.pactStartTime = pactStartTime;
	}

	public java.util.Date getPactEndTime() {
		return pactEndTime;
	}

	public void setPactEndTime(Date pactEndTime) {
		this.pactEndTime = pactEndTime;
	}

	public boolean isType() {
		return type;
	}

	public void setType(boolean type) {
		this.type = type;
	}

	public Company getComp() {
		return comp;
	}

	public void setComp(Company comp) {
		this.comp = comp;
	}

	
}